#coding=utf-8
import unittest
from selenium import webdriver
from appium import webdriver
from time import sleep
from nav_plugin_op import nav_plugin_factory
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.support.ui import WebDriverWait
import os
from Public import BasePage
from Tool.usefulTools import userfulToolsFactory
from Public.BasePage import element_Oprate
from Public.BasePage import BasicAction

navOpenFactory = nav_plugin_factory()
userfulTool = userfulToolsFactory()
element_oprate_instance = element_Oprate()
basicAction = BasicAction()

# nav_name = "工作"
# plugin_name = "案件处置"
nav_name = ["导航栏工作",'xpath',"//android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.FrameLayout/android.widget.RadioButton"]
plugin_name = ["插件列表-违建核查",'name','违建核查']

class illegal_verification_factory():

	def open_illegalverification_plug(self,driver,file_path):
		try:
			element_oprate_instance.element_click(nav_name,file_path)
			driver.swipe(400,1000,400,200,1200)
			sleep(2)
			element_oprate_instance.element_click(plugin_name,file_path)
			driver.implicitly_wait(15)
			element_oprate_instance.element_save_pic(file_path, 'open_illegalverification_plug_successful')

		except WebDriverException,error:
			print error
			element_oprate_instance.element_save_pic(file_path, 'open_illegalverification_plug_fail')
			raise
			
if __name__ == '__main__':
	unittest.main()